import time
import logging
import threading

class Streamer:
    def __init__(self):
        self.run = False
        self.__log_init()


    def __log_init(self):
        self.logger = logging.getLogger("Streamer")


    def open(self):
        self.logger.trace('open.enter')
        self.logger.trace('open.done')


    def close(self):
        self.logger.trace('close.enter')
        self.logger.trace('close.done')


    def thread(self):
        self.logger.trace('thread.enter')
        number = 0
        while self.run:
            number += 1
            self.logger.spam(f"number: {number}")
            time.sleep(1)
        self.logger.trace('thread.done')


    def start(self):
        self.logger.trace('start.enter')
        self.run = True
        self.handle = threading.Thread(target=self.thread)
        self.handle.start()
        self.logger.trace('start.done')
        return True


    def stop(self):
        self.logger.trace('stop.enter')
        self.run = False
        self.handle.join()
        self.logger.trace('stop.done')


    def input_queue_set(self, queue):
        self.logger.trace('input_queue_set.enter')
        self.logger.trace('input_queue_set.done')
        return True
